package com.usian.behavior.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.usian.behavior.mapper.ApBehaviorEntryMapper;
import com.usian.behavior.service.ApBehaviorEntryService;
import com.usian.model.behavior.pojos.ApBehaviorEntry;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.common.enums.AppHttpCodeEnum;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * ClassName: ApBehaviorEntryMapper
 * Author:   WGG
 * Date:    2022-12-2022/12/1-10:09
 * Version: 1.0
 * Description:
 */
@Service
public class ApBehaviorEntryServiceImpl extends ServiceImpl<ApBehaviorEntryMapper,ApBehaviorEntry> implements ApBehaviorEntryService {
    @Override
    public ApBehaviorEntry showBehavior(Integer entryId,Integer equipmentId) {
        ApBehaviorEntry apBehaviorEntry = null;
        //用户登录
        if (entryId!=null){
            apBehaviorEntry = getOne(Wrappers.<ApBehaviorEntry>lambdaQuery().eq(ApBehaviorEntry::getEntryId,entryId));
        }
        //设备登录
        if (entryId==null && equipmentId!=null){
            apBehaviorEntry = getOne(Wrappers.<ApBehaviorEntry>lambdaQuery().eq(ApBehaviorEntry::getEntryId,equipmentId));
        }
        return apBehaviorEntry;

    }
}
